package com.pro.controller;/**
 * @Author 许振杰
 * @Date 2022/1/27 0027 21:33
 * @Version 1.0
 */

import com.pro.pojo.JsClosure;
import com.pro.pojo.JsUnseal;
import com.pro.pojo.JsonData;
import com.pro.service.JsClosureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
* @Title: 封停记录 controller层
* @author 许振杰
* @date 2022/1/27 0027 21:37
* @version V1.01
*/
@Controller
@RequestMapping(value = "closure")
public class JsClosureController {

    @Autowired
    private JsClosureService closureService;

    /**
    * @Title: 前端封停记录列表
    * @author 许振杰
    * @date 2022/1/27 0027 21:36
    * @version V1.0
    */
    @RequestMapping(value = "getAllClosure")
    @ResponseBody
    public JsonData getAllClosure(JsClosure closure){
        List<JsClosure> allClosure = closureService.getAllClosure(closure);
        return allClosure!=null ? JsonData.buildSuccess(allClosure) : JsonData.buildError("服务器出错了");
    }

    /**
    * @Title: 前端封停记录的高级检索
    * @author 许振杰
    * @date 2022/1/29 0029 21:15
    * @version V1.0
    */
    @RequestMapping(value = "getClosureAdvancedRetrieval")
    @ResponseBody
    public JsonData getClosureAdvancedRetrieval(JsClosure closure){
        List<JsClosure> closureAdvancedRetrieval = closureService.getClosureAdvancedRetrieval(closure);
        return closureAdvancedRetrieval != null ? JsonData.buildSuccess(closureAdvancedRetrieval) : JsonData.buildError("服务器出错了");
    }

    /**
    * @Title: 删除封停记录
    * @author 许振杰
    * @date 2022/1/29 0029 21:16
    * @version V1.0
    */
    @RequestMapping(value = "delClosureById")
    @ResponseBody
    public JsonData delClosureById(Integer id){
        boolean delClosureById = closureService.delClosureById(id);
        return delClosureById ? JsonData.buildSuccess(delClosureById) : JsonData.buildError("服务器出错了");
    }

    /**
    * @Title: 添加解封日志
    * @author 许振杰
    * @date 2022/1/29 0029 22:08
    * @version V1.0
    */
    @RequestMapping(value = "addUnsealLog")
    @ResponseBody
    public JsonData addUnsealLog(JsUnseal unseal){
        boolean addUnsealLog = closureService.addUnsealLog(unseal);
        return addUnsealLog ? JsonData.buildSuccess(addUnsealLog) : JsonData.buildError("服务器出错了");
    }

    /**
    * @Title: 前端封停日志列表
    * @author 许振杰
    * @date 2022/1/30 0030 15:27
    * @version V1.0
    */
    @RequestMapping(value = "getAllUnseal")
    @ResponseBody
    public JsonData getAllUnseal(JsUnseal unseal){
        List<JsUnseal> allUnseal = closureService.getAllUnseal(unseal);
        return allUnseal!=null ? JsonData.buildSuccess(allUnseal) : JsonData.buildError("服务器出错了");
    }

    /**
    * @Title: 前端封停日志的高级检索
    * @author 许振杰
    * @date 2022/1/30 0030 15:28
    * @version V1.0
    */
    @RequestMapping(value = "getUnsealAdvancedRetrieval")
    @ResponseBody
    public JsonData getUnsealAdvancedRetrieval(JsUnseal unseal){
        List<JsUnseal> unsealAdvancedRetrieval = closureService.getUnsealAdvancedRetrieval(unseal);
        return unsealAdvancedRetrieval!=null ? JsonData.buildSuccess(unsealAdvancedRetrieval) : JsonData.buildError("服务器出错了");
    }

    /**
    * @Title: 删除解封日志
    * @author 许振杰
    * @date 2022/1/30 0030 15:29
    * @version V1.0
    */
    @RequestMapping(value = "delUnseal")
    @ResponseBody
    public JsonData delUnseal(Integer id){
        boolean delUnseal = closureService.delUnseal(id);
        return delUnseal ? JsonData.buildSuccess(delUnseal) : JsonData.buildError("服务器出错了");
    }

    /**
    * @Title: 根据userId查询用户信息
    * @author 许振杰
    * @date 2022/2/8 0008 20:33
    * @version V1.0
    */
    @RequestMapping(value = "getClosureByUserId")
    @ResponseBody
    public JsonData getClosureByUserId(JsClosure closure){
        JsClosure closureByUserId = closureService.getClosureByUserId(closure);
        return closureByUserId!=null ? JsonData.buildSuccess(closureByUserId) : JsonData.buildError("服务器出错了");
    }

}
